from flask import Flask, render_template, request
from config import config
from base.my_class import GetCarInvoiceInfoArgs
import pymain
from common.utils import utils
import threading
app = Flask(__name__)

@app.route('/getCarInvoiceInfo', methods=['GET'])
def getCarInvoiceInfo():
    if request.method == 'GET':
        #data = request.form.get('data')
        #print(data)
            #config.init_config()
            uuid = request.args.get('uuid')
            passid = request.args.get('passid')
            carPlate = request.args.get('carPlate')
            start_time = request.args.get('startTime')
            end_time = request.args.get('endTime')
            print(request.args,"111")
            print(uuid)
            print(passid)
            print(carPlate)
            print(start_time)
            print(end_time)
            args = GetCarInvoiceInfoArgs(uuid,passid,carPlate,start_time,end_time)
            thread = threading.Thread(target= pymain.getCarInvoiceInfo,args=([args]))
            thread.start()
            return ("OK" + str(args.uuid) + str(utils.getTimeStamp()))
            
    return "请使用GET请求"
def startWebServer():
      
      return

if __name__ == '__main__':
    print(config,"config")
    app.run(host='0.0.0.0',port=config.port)